package com.lzw.breezeNovel.webApp.controller.comic;

import com.lzw.breezeNovel.common.result.Result;
import com.lzw.breezeNovel.model.entity.query.PaginationResultQuery;
import com.lzw.breezeNovel.webApp.service.comic.ComicCommentService;
import com.lzw.breezeNovel.webApp.vo.comic.ComicCommentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;



/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.controller.comic
 * @date 2025/3/16
 * @description 用户评论表
 */
@RestController
@SuppressWarnings("all")
@RequestMapping("/app/comic/comment")
public class ComicCommentController {

    /**
     * 注入service
     */
    @Autowired
    private ComicCommentService comicCommentService;

    /**
     * 获取所有的评论
     */
    @RequestMapping("/getComment")
    public Result<PaginationResultQuery<ComicCommentVo>> getComment(@RequestParam("comicId") Long comicId, @RequestParam Integer pageNo , @RequestParam Integer size){
         PaginationResultQuery<ComicCommentVo> comicCommentVoPaginationResultQuery = comicCommentService.selectByComicId(comicId,pageNo,size);
         return Result.ok(comicCommentVoPaginationResultQuery);
    }

    /**
     * 发布评分
     */
    @RequestMapping("/post")
    public Result publishComment(@RequestParam Long comicId, @RequestParam String content){
        comicCommentService.publishComment(comicId,content);
        return Result.ok();
    }


}
